<template>
  <div class="controlPermission">
    <div class="perSearch">
      <el-form :inline="true">
        <el-form-item label="权限名称：">
          <el-input placeholder="请输入内容" v-model="searchPerName" size="small" />
        </el-form-item>
        <el-form-item label="权限代码：">
          <el-input placeholder="请输入内容" v-model="searchPerCode" size="small" />
        </el-form-item>
        <el-form-item label="权限状态：">
          <el-select size="small" disabled v-model="searchStateValue" placeholder="暂不支持使用">
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button color="#1ab394" class="search-button" @click="fnPerSearch" size="small">查找</el-button>
          <el-button color="#f8ac59" class="search-button" @click="headleSearchReset" size="small">重置</el-button>
        </el-form-item>
      </el-form>
    </div>
    <div class="perMain">
      <el-row>
        <el-button color="#1c84c6" size="mini" class="mainButton" @click="handleShowAdd">新增</el-button>
        <el-button color="#1ab394" size="mini" class="mainButton" :disabled="bjDisabled" @click="handleShowUpdate">修改</el-button>
        <el-button color="#ed5565" size="mini" class="mainButton" @click="fnPerDelete" :disabled="scDisabled">删除</el-button>
      </el-row>
      <el-table
        ref="multipleTable"
        :data="tableData"
        size="mini"
        @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="55" />
        <el-table-column prop="pId" label="权限编号" width="180" />
        <el-table-column prop="pName" label="权限名称" width="180" />
        <el-table-column prop="code" label="权限代码" />
        <el-table-column prop="remark" label="权限说明" />
        <el-table-column prop="status" label="权限状态">
          <template #default="scope">
            {{ ACCOUNT_STATUS[scope.row.status] ? ACCOUNT_STATUS[scope.row.status] : '--' }}
          </template>
        </el-table-column>
        <el-table-column prop="createTime" :formatter="timeForMat" width="180" label="权限创建时间" />
        <el-table-column prop="updateTime" :formatter="timeForMat" width="180" label="权限最后更新时间" />
      </el-table>
    </div>
    <!-- 新增用户 -->
    <el-dialog
      v-model="dialogFormVisible"
      title="新增权限"
      @close="handleClearValue"
      :close-on-click-modal="false"
    >
      <el-form class="formPositon" :inline="true" label-width="120px">
        <el-form-item label="权限名称">
          <el-input v-model="pName" />
        </el-form-item>
        <el-form-item label="权限代码">
          <el-input v-model="code" />
        </el-form-item>
        <el-form-item label="权限说明">
          <el-input v-model="remark" />
        </el-form-item>
        <el-form-item label="权限状态">
          <el-select size="small" v-model="status" placeholder="请选择">
            <el-option
              v-for="item in perOption"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="dialogFormVisible = false">取消</el-button>
          <el-button type="primary" @click="subAddOrUpdate">提交</el-button>
        </span>
      </template>
    </el-dialog>
  </div>
</template>
<script lang="ts">
import './index.less'
import indexT from './indexT'

export default indexT
</script>
